<?php
use App\Core\Router;
use App\Controller\UserController;


use Monolog\Logger;
use Monolog\Handler\StreamHandler;

define('APP_PATH', str_replace('\\', '/', __DIR__));//str_replace — 子字符串替换  __DIR__，指向当前执行的PHP脚本所在的目录。
define('DS', '/');
define('TEMPLATES_PATH', APP_PATH . '/templates');
define('CONFIG_PATH', APP_PATH . '/config');
define('CORE_PATH', APP_PATH . '/core');
@include_once(APP_PATH . DS . 'vendor/autoload.php');

$router = new Router();
list($controller, $action) = $router->match(); //list — 把数组中的值赋给一些变量*/

$con = new $controller();
$con->$action();

$r=new UserController();
$r->listUser();





/*// create a log channel
$log = new Logger('name');

$log->pushHandler(new StreamHandler(APP_PATH.DS.'data/log/logInfo.txt.log', Logger::WARNING));

// add records to the log
$log->warning('Foo');
$log->error('Bar');


var_dump($log);*/